package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;

public class PivotTable {
   PivotTableCollection a;
   zbrw b;
   zbqq c;
   zauk d;
   zbrx e;
   PivotField f;
   ArrayList g;
   ArrayList h;
   int i;
   int j;
   int k;
   int l;
   int m;
   int n;
   int o;
   int p = -1;
   int q = -1;
   boolean r;
   boolean s;
   boolean t;
   boolean u = true;
   boolean v = true;
   boolean w = false;
   boolean x = false;
   boolean y;
   int z;
   boolean A;
   int B;
   int C = 1;
   boolean D;
   boolean E;
   boolean F = true;
   boolean G = true;
   boolean H = true;
   boolean I = true;
   boolean J = false;
   boolean K = false;
   boolean L = false;
   boolean M;
   boolean N;
   boolean O;
   String P;
   String Q;
   String R = "{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}";
   String S;
   int T;
   int U;
   int V;
   String W;
   String X;
   ArrayList Y;
   zbrq Z;
   int aa;
   zauj ab;
   zavc ac = null;
   int[][] ad;
   int[][] ae;
   boolean af = true;
   zbqz ag;
   boolean ah = false;
   PivotFilterCollection ai;
   PivotFormatConditionCollection aj;
   PivotField ak;
   private Object ao;
   private boolean ap = true;
   private boolean aq = true;
   private String ar;
   private String as;
   zaut al = null;
   int am = -1;
   boolean an = false;
   private byte at = 19;

   void a() {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.c();
   }

   boolean b() {
      return this.Y != null;
   }

   private void h() {
      this.j = this.i + 13;
      this.l = (short)(this.k + 6);
      this.m = this.n = this.i + 1;
      this.o = this.k + 1;
   }

   void a(CellArea var1) {
      ArrayList var2 = (ArrayList)this.b.b.a.clone();
      int var3 = var2.size();
      PivotFieldCollection var4 = new PivotFieldCollection(this, this.d);
      ArrayList var5 = new ArrayList();

      int var6;
      for(var6 = 0; var6 < var4.getCount(); ++var6) {
         com.aspose.cells.b.a.a.ze.a(var5, (Object)var4.get(var6).getName());
      }

      PivotField var8;
      for(var6 = 0; var6 < var3; ++var6) {
         boolean var7 = false;
         var8 = (PivotField)var2.get(var6);

         PivotField var10;
         for(int var9 = 0; var9 < var4.getCount(); ++var9) {
            var10 = var4.get(var9);
            if (var10.getName().toUpperCase().equals(var8.getName().toUpperCase())) {
               var7 = true;
               var10.a(var8);
               var10.m = var8.m;
               var10.u = var8.u;
               var5.remove(var10.getName());
               break;
            }
         }

         PivotField var12 = (PivotField)var2.get(var6);
         if (var12.isCalculatedField()) {
            var7 = true;
            if (var12.c() != var4.getCount()) {
               var12.a(var4.getCount());
            }

            var4.a(var12);
         }

         if (var12.getRange() != null && var12.getRange().d.size() > 0 && !var7) {
            var7 = true;
            if (var12.c() != var4.getCount()) {
               var12.a(var4.getCount());
            }

            var4.a(var12);
         }

         if (!var7) {
            var10 = (PivotField)var2.get(var6);
            this.b(var10);
         }
      }

      this.b.b.a = var4.a;

      PivotField var11;
      for(var6 = 0; var6 < this.b.d.a.size(); ++var6) {
         var11 = (PivotField)this.b.d.a.get(var6);
         var8 = this.b.b.get(var11.getName());
         if (var11.c() != -2 && var8 != null) {
            var11.a(var8.c());
         }
      }

      for(var6 = 0; var6 < this.b.e.a.size(); ++var6) {
         var11 = (PivotField)this.b.e.a.get(var6);
         var8 = this.b.b.get(var11.getName());
         if (var11.c() != -2 && var8 != null) {
            var11.a(var8.c());
         }
      }

      for(var6 = 0; var6 < this.b.c.a.size(); ++var6) {
         var11 = (PivotField)this.b.c.a.get(var6);
         var8 = this.b.b.get(var11.getName());
         if (var8 != null) {
            var11.setBaseIndex(var8.c());
         }
      }

      for(var6 = 0; var6 < this.b.f.a.size(); ++var6) {
         var11 = (PivotField)this.b.f.a.get(var6);
         var8 = this.b.b.get(var11.getName());
         if (var8 != null) {
            var11.a(var8.c());
         }
      }

   }

   int a(ArrayList var1) {
      for(int var2 = 0; var2 < var1.size(); ++var2) {
         Object var3 = var1.get(var2);
         if (var3 != null) {
            PivotItem var4 = (PivotItem)var3;
            if (var4.getValue() == null && !var4.c()) {
               return var2;
            }
         }
      }

      return -1;
   }

   void c() {
      if (this.d != null) {
         for(int var1 = 0; var1 < this.d.p.size(); ++var1) {
            Object var2 = null;
            boolean var3 = false;
            PivotField var4 = this.getBaseFields().get(var1);
            if (!var4.isCalculatedField()) {
               if (var4.getRange() != null) {
                  zbqs var21 = (zbqs)this.d.p.get(var1);
                  zbqs var22 = (zbqs)this.d.p.get(var4.getRange().k);
                  if (var21.o && var22.c.size() == 1 && ((zbmb)var22.c.get(0)).a == null) {
                     this.d.p.remove(var21);
                     this.b(var4);
                  } else if (var22.c.size() == 1 && ((zbmb)var22.c.get(0)).a == null) {
                     var4.a();
                     var4.e();
                     var4.b();
                  }
               } else {
                  boolean var5 = false;
                  int var6 = -1;
                  boolean var7 = false;
                  if (var4.m == 4) {
                     short var20 = var4.getCurrentPageItem();
                     if (var20 >= 0 && var20 < var4.getPivotItems().getCount()) {
                        var2 = var4.getPivotItems().get(var20).getValue();
                        var3 = true;
                     }
                  }

                  var4.f();
                  ArrayList var8 = (ArrayList)var4.getPivotItems().b.clone();
                  var4.h = (zbqs)this.d.p.get(var1);
                  if (var4.d != null && var4.d.getCount() > 0) {
                     HashMap var9 = new HashMap();
                     if (var4.h.c != null) {
                        int var10 = var4.h.c.size();

                        for(int var11 = 0; var11 < var10; ++var11) {
                           Object var12 = ((zbmb)var4.h.c.get(var11)).a;
                           if (var12 != null) {
                              var9.put(var12, var11);
                           } else {
                              var6 = var11;
                           }
                        }

                        ArrayList var23 = new ArrayList();

                        PivotItem var13;
                        for(int var24 = 0; var24 < var4.d.getCount(); ++var24) {
                           var13 = var4.d.get(var24);
                           if (var13.b()) {
                              var4.d.a(var24--);
                              var9.remove(var13.i);
                              com.aspose.cells.b.a.a.ze.a(var23, (Object)var13);
                           } else if (var13.i == null) {
                              var4.d.a(var24--);
                           } else if (var9.containsKey(var13.i)) {
                              var4.d.a(var24--);
                           } else {
                              var4.d.a(var24--);
                           }
                        }

                        PivotItem var16;
                        if (var9.size() > 0) {
                           ArrayList var28 = new ArrayList(var9.values());
                           Collections.sort(var28);
                           Iterator var25 = var28.iterator();

                           label229:
                           while(true) {
                              label214:
                              do {
                                 while(true) {
                                    if (!var25.hasNext()) {
                                       break label229;
                                    }

                                    int var14 = (Integer)var25.next();
                                    com.aspose.cells.b.a.a.zc var15 = com.aspose.cells.b.a.a.zf.a(var9);

                                    while(var15.c()) {
                                       if ((Integer)var15.b() == var14) {
                                          continue label214;
                                       }
                                    }
                                 }
                              } while(var4.d.getCount() >= var10);

                              var16 = new PivotItem(var4.d);
                              var4.d.a(var16);
                              PivotItem var17;
                              if (var6 == -1) {
                                 var16.setIndex(var4.d.getCount() - 1);
                              } else if (var4.d.getCount() == var6 + 1) {
                                 var16.setIndex(var6);
                                 var17 = new PivotItem(var4.d);
                                 var4.d.a(var17);
                                 var17.setIndex(var4.d.getCount() - 1);
                                 var7 = true;
                              } else {
                                 var16.setIndex(var4.d.getCount() - 1);
                              }

                              var17 = null;
                              int var18 = var8.size();

                              for(int var19 = 0; var19 < var18; ++var19) {
                                 var17 = (PivotItem)var8.get(var19);
                                 if (var17.getValue() != null && var17.getValue().equals(var16.getValue()) || var17.getValue() == var16.getValue()) {
                                    var16.c = var17.c;
                                    var16.d = var17.d;
                                    if (!var4.g && var16.getIndex() != var19 && var6 == -1) {
                                       var4.g = true;
                                    }
                                 }
                              }
                           }
                        }

                        if (var4.h.u() && !var7 && var6 < var10) {
                           PivotItem var30 = new PivotItem(var4.d);
                           var30.setIndex(var6);
                           int var26 = this.a(var8);
                           if (var26 != -1 && var26 < var4.d.getCount()) {
                              var4.d.b.add(var26, var30);
                           } else {
                              var4.d.a(var30);
                           }

                           Iterator var27 = var8.iterator();

                           while(var27.hasNext()) {
                              PivotItem var32 = (PivotItem)var27.next();
                              if (var32.getValue() == null) {
                                 var30.c = var32.c;
                                 var30.d = var32.d;
                              }
                           }
                        }

                        if (var23.size() > 0) {
                           Iterator var31 = var23.iterator();

                           while(var31.hasNext()) {
                              var13 = (PivotItem)var31.next();
                              var4.d.a(var13);
                           }
                        }

                        if (var4.d.getCount() == 1 && var4.d.get(0).isHidden()) {
                           var4.d.get(0).setHidden(false);
                        }

                        if (var3) {
                           double var33 = 0.0D;
                           boolean var29 = false;

                           for(int var34 = 0; var34 < var4.d.getCount(); ++var34) {
                              var16 = var4.d.get(var34);
                              if (var2 instanceof Double) {
                                 if (var16.getValue() instanceof Integer) {
                                    var33 = (double)(Integer)var16.getValue();
                                 }

                                 var29 = var2.equals(var33);
                              }

                              if (var2 != null && (var29 || var2.equals(var16.getValue())) || var2 == null && var16.getValue() == null) {
                                 var4.setCurrentPageItem((short)var34);
                                 break;
                              }

                              if (var2 == null && var16.getValue() != null) {
                                 var4.setCurrentPageItem((short)32765);
                                 break;
                              }
                           }

                           if (var4.getCurrentPageItem() >= var4.d.getCount()) {
                              var4.setCurrentPageItem((short)32765);
                           }
                        }
                     }
                  }
               }
            }
         }
      }

   }

   PivotTable(PivotTableCollection pivotTables, zauk pivotCache, int row, short column, String tableName) {
      this.a = pivotTables;
      this.i = row;
      this.k = column;
      this.h();
      this.s = true;
      this.D = true;
      this.E = true;
      this.e = new zbrx(this);
      this.d = pivotCache;
      ++pivotCache.o;
      this.b = new zbrw(this, tableName);
      this.c = new zbqq(this);
      this.Z = new zbrq(tableName);
      this.ab = new zauj();
      this.ab.a(this);
      this.ag = new zbqz(this);
      this.ai = new PivotFilterCollection(this);
      if (pivotCache.d == 4) {
         this.addFieldToArea(1, 0);
         this.addFieldToArea(2, 1);
         this.addFieldToArea(8, 2);

         for(int var6 = 3; var6 < this.getBaseFields().getCount(); ++var6) {
            this.addFieldToArea(4, var6);
         }
      }

   }

   ArrayList a(int var1) {
      ArrayList var2 = new ArrayList();

      for(int var3 = 0; var3 < this.g.size(); ++var3) {
         int[] var4 = (int[])((int[])this.g.get(var3));
         if (var4[0] == var1) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)(var3 + this.n));
         }
      }

      return var2;
   }

   int a(PivotField var1) {
      int var2;
      PivotField var3;
      if (var1.m == 2) {
         for(var2 = 0; var2 < this.getColumnFields().getCount(); ++var2) {
            var3 = this.getColumnFields().get(var2);
            if (var3.equals(var1)) {
               return var2 + this.i + 1;
            }
         }
      } else if (var1.m == 1) {
         for(var2 = 0; var2 < this.getRowFields().getCount(); ++var2) {
            var3 = this.getRowFields().get(var2);
            if (var3.equals(var1)) {
               return var2;
            }
         }
      } else {
         for(var2 = 0; var2 < this.getDataFields().getCount(); ++var2) {
            var3 = this.getDataFields().get(var2);
            if (var3.equals(var1)) {
               return var2;
            }
         }
      }

      return -1;
   }

   ArrayList a(zzn var1, boolean var2, zaay var3) {
      ArrayList var4 = new ArrayList();
      new CellArea();
      CellArea var5;
      if (var2) {
         var5 = this.getColumnRange();
      } else {
         var5 = this.getRowRange();
      }

      zhg var6 = new zhg(this.a.b.getCells(), var5, true, 5);

      while(var6.hasNext()) {
         zfv var7 = var6.e();
         var1.c(zaaq.a(var7.c, var7.d));
         zagu var8 = var1.d(var3);
         if (var8.b() == 1 && ((zyv)var8).k()) {
            com.aspose.cells.b.a.a.ze.a(var4, (Object)(new int[]{var6.c().h(), var7.a}));
         }
      }

      return var4;
   }

   ArrayList a(Object var1, boolean var2) {
      ArrayList var3 = new ArrayList();
      new CellArea();
      CellArea var4;
      if (var2) {
         var4 = this.getColumnRange();
      } else {
         var4 = this.getRowRange();
      }

      for(int var5 = var4.StartRow; var5 <= var4.EndRow; ++var5) {
         for(int var6 = var4.StartColumn; var6 <= var4.EndColumn; ++var6) {
            Cell var7 = this.a.b.getCells().get(var5, var6);
            Object var8 = zmc.a(var7.F(), var1, "=", false);
            if (var8 instanceof Boolean & (Boolean)var8) {
               com.aspose.cells.b.a.a.ze.a(var3, (Object)(new int[]{var5, var6}));
            }
         }
      }

      return var3;
   }

   int b(int var1) {
      for(int var2 = 0; var2 < this.g.size(); ++var2) {
         zbrd var3 = new zbrd((int[])((int[])this.g.get(var2)));
         if (var3.d() && var3.f() == var1) {
            return var2;
         }
      }

      return 0;
   }

   int a(int var1, int var2) {
      int[] var3 = (int[])((int[])this.g.get(var1 - this.n));
      int var4 = var3[0];
      new ArrayList();

      for(int var6 = 0; var6 < this.g.size(); ++var6) {
         zbrd var7 = new zbrd((int[])((int[])this.g.get(var6)));
         boolean var8 = false;

         int var9;
         for(var9 = 0; var9 <= var2; ++var9) {
            if (var3[4 + var9] != var7.f[var9]) {
               var8 = true;
               break;
            }
         }

         if (!var8 && var7.c()) {
            for(var9 = var2 + 1; var9 < var7.f.length; ++var9) {
               if (var7.f[var9] != 32767) {
                  var8 = true;
                  break;
               }
            }

            if (!var8) {
               return var6 + this.n;
            }
         }
      }

      return 0;
   }

   PivotTable(PivotTableCollection pivotTables) {
      this.a = pivotTables;
      this.s = true;
      this.e = new zbrx(this);
      this.b = new zbrw(this);
      this.c = new zbqq(this);
      this.Z = new zbrq();
      this.ab = new zauj();
      this.D = true;
      this.E = true;
      this.ag = new zbqz(this);
      this.ai = new PivotFilterCollection(this);
   }

   TableStyle d() {
      if (this.ao == null) {
         return this.a.b.c().getTableStyles().a(0);
      } else if (this.ao instanceof String) {
         return this.a.b.c().getTableStyles().get((String)this.ao);
      } else if (this.ao instanceof Integer) {
         return this.a.b.c().getTableStyles().a((Integer)this.ao);
      } else {
         return this.ao instanceof TableStyle ? (TableStyle)this.ao : this.a.b.c().getTableStyles().a(37);
      }
   }

   public String getPivotTableStyleName() {
      if (this.ao == null) {
         return null;
      } else if (this.ao instanceof String) {
         return (String)this.ao;
      } else {
         return this.ao instanceof TableStyle ? ((TableStyle)this.ao).getName() : zavb.h((Integer)this.ao);
      }
   }

   public void setPivotTableStyleName(String value) {
      this.af = true;
      int var2 = zavb.d(value);
      if (var2 != 85 && var2 != 0) {
         this.ao = var2;
      } else {
         this.ao = value;
      }

   }

   public int getPivotTableStyleType() {
      if (this.ao == null) {
         return 0;
      } else {
         return this.ao instanceof String ? 85 : (Integer)this.ao;
      }
   }

   public void setPivotTableStyleType(int value) {
      this.af = true;
      this.ao = value;
   }

   public void copyStyle(PivotTable pivotTable) {
      WorksheetCollection var2 = this.a.b.getWorkbook().getWorksheets();
      if ((pivotTable.ag.getCount() == 0 || pivotTable.ao != null) && !"None".equals(pivotTable.d().getName())) {
         this.setPivotTableStyleName(pivotTable.getPivotTableStyleName());
         WorksheetCollection var3 = pivotTable.a.b.getWorkbook().getWorksheets();
         if (var3.getTableStyles().get(pivotTable.d().getName()) != null) {
            int var4 = var2.getTableStyles().c(pivotTable.d().getName());
            TableStyle var5 = var2.getTableStyles().get(var4);
            var5.a(pivotTable.d());
            this.setPivotTableStyleName(var5.getName());
            this.ao = var5;
         }
      }

   }

   void a(PivotTable var1) throws Exception {
      Iterator var2;
      if (var1.Y != null) {
         this.Y = new ArrayList();
         var2 = var1.Y.iterator();

         while(var2.hasNext()) {
            byte[] var6 = (byte[])var2.next();
            byte[] var7 = new byte[var6.length];
            System.arraycopy(var6, 0, var7, 0, var7.length);
            com.aspose.cells.b.a.a.ze.a(this.Y, (Object)var7);
         }

      } else {
         this.i = var1.i;
         this.k = var1.k;
         this.j = var1.j;
         this.l = var1.l;
         this.o = var1.o;
         this.n = var1.n;
         this.m = var1.m;
         this.t = var1.t;
         if (this.s) {
            int[] var3;
            int[] var4;
            if (var1.g != null) {
               this.g = new ArrayList(var1.g.size());
               var2 = var1.g.iterator();

               while(var2.hasNext()) {
                  var3 = (int[])var2.next();
                  var4 = new int[var3.length];
                  System.arraycopy(var3, 0, var4, 0, var4.length);
                  com.aspose.cells.b.a.a.ze.a(this.g, (Object)var4);
               }
            }

            if (var1.h != null) {
               this.h = new ArrayList(var1.h.size());
               var2 = var1.h.iterator();

               while(var2.hasNext()) {
                  var3 = (int[])var2.next();
                  var4 = new int[var3.length];
                  System.arraycopy(var3, 0, var4, 0, var4.length);
                  com.aspose.cells.b.a.a.ze.a(this.h, (Object)var4);
               }
            }
         }

         Worksheet var5 = this.a.b;
         this.e = new zbrx(this);
         this.e.a(var1.e);
         if (var1.ag != null && var1.ag.getCount() != 0) {
            this.ag = new zbqz(this);
            this.ag.a(var1.ag);
         }

         if (var1.ai != null && var1.ai.getCount() != 0) {
            this.ai = new PivotFilterCollection(this);
            this.ai.a(var1.ai);
         }

         if (var1.aj != null && var1.aj.getCount() != 0) {
            this.aj = new PivotFormatConditionCollection(this, var5);
            this.aj.a(var1.aj);
         }

         this.setPivotTableStyleName(var1.getPivotTableStyleName());
         this.C = var1.C;
         this.u = var1.u;
         this.v = var1.v;
         this.w = var1.w;
         this.x = var1.x;
         this.K = var1.K;
         this.L = var1.L;
         this.J = var1.J;
         this.I = var1.I;
         this.D = var1.D;
         this.as = var1.as;
         this.ar = var1.ar;
         this.setShowPivotStyleRowHeader(var1.getShowPivotStyleRowHeader());
         this.setShowPivotStyleColumnHeader(var1.getShowPivotStyleColumnHeader());
         this.setShowPivotStyleRowStripes(var1.getShowPivotStyleRowStripes());
         this.setShowPivotStyleColumnStripes(var1.getShowPivotStyleColumnStripes());
         this.setShowPivotStyleLastColumn(var1.getShowPivotStyleLastColumn());
         this.aa = var1.aa;
         this.F = var1.F;
         this.H = var1.getShowMemberPropertyTips();
         this.d = var5.c().U().a(var1.d, var5);
         this.b = new zbrw(this, var1.getName());
         this.b.a(var1.b.b.getCount());
         if (this.getBaseFields().getCount() > 0) {
            this.b.a(var1.b);
         }

         this.c = new zbqq(this);
         this.c.a(var1.c);
         this.Z = new zbrq();
         this.Z.a(var1.Z);
         this.ab.a(var1.ab);
         this.s = var1.s;
         this.al = null;
      }
   }

   void e() {
      this.s = true;
      zaut var1 = new zaut(this);
      if (this.d != null && this.d.n != null) {
         var1.b();
      }

   }

   void b(PivotField var1) {
      this.al = null;
      this.b.b.a.remove(var1);
      switch(var1.m) {
      case 1:
         this.b.d.a.remove(var1);
         break;
      case 2:
         this.b.e.a.remove(var1);
         break;
      case 3:
      case 5:
      case 6:
      case 7:
      default:
         if (var1.h()) {
            this.b.c.a.remove(this.b.c.get(var1.getName()));
         }
         break;
      case 4:
         this.b.f.a.remove(var1);
         break;
      case 8:
         this.b.c.a.remove(var1);
      }

   }

   public void removeField(int fieldType, String fieldName) {
      if (this.getDataField() != null && com.aspose.cells.b.a.zv.b(fieldName, this.getDataField().getName())) {
         this.removeField(fieldType, this.getDataField());
      } else {
         for(int var3 = 0; var3 < this.getBaseFields().getCount(); ++var3) {
            if (com.aspose.cells.b.a.zv.b(this.getBaseFields().get(var3).getName(), fieldName)) {
               this.removeField(fieldType, this.getBaseFields().get(var3));
               break;
            }
         }

      }
   }

   public void removeField(int fieldType, int baseFieldIndex) {
      this.removeField(fieldType, this.getBaseFields().get(baseFieldIndex));
   }

   public void removeField(int fieldType, PivotField pivotField) {
      this.al = null;
      if (null != pivotField) {
         if (fieldType != 0) {
            if (pivotField.isCalculatedField() && fieldType != 8) {
               throw new IllegalArgumentException("You could not del calculated field.");
            }

            this.fields(fieldType).c(pivotField);
         }

      }
   }

   public int addFieldToArea(int fieldType, String fieldName) {
      for(int var3 = 0; var3 < this.getBaseFields().getCount(); ++var3) {
         if (com.aspose.cells.b.a.zv.b(this.getBaseFields().get(var3).getName(), fieldName)) {
            return this.addFieldToArea(fieldType, this.getBaseFields().get(var3));
         }
      }

      return -1;
   }

   public int addFieldToArea(int fieldType, int baseFieldIndex) {
      return this.addFieldToArea(fieldType, this.getBaseFields().get(baseFieldIndex));
   }

   public int addFieldToArea(int fieldType, PivotField pivotField) {
      this.al = null;
      if (fieldType != 0) {
         if (pivotField.isCalculatedField() && fieldType != 8) {
            throw new IllegalArgumentException("You could not drag calculated field to this area.");
         } else {
            return this.fields(fieldType).add(pivotField);
         }
      } else {
         return -1;
      }
   }

   public void addCalculatedField(String name, String formula, boolean dragToDataArea) {
      this.al = null;
      this.d.a(name, formula);
      if (dragToDataArea) {
         this.addFieldToArea(8, this.b.b.getCount() - 1);
      }

   }

   public void addCalculatedField(String name, String formula) {
      this.addCalculatedField(name, formula, true);
   }

   public PivotFieldCollection fields(int fieldType) {
      switch(fieldType) {
      case 0:
         return this.getBaseFields();
      case 1:
         return this.getRowFields();
      case 2:
         return this.getColumnFields();
      case 3:
      case 5:
      case 6:
      case 7:
      default:
         throw new IllegalArgumentException("Invalid pivot field type");
      case 4:
         return this.getPageFields();
      case 8:
         return this.getDataFields();
      }
   }

   public PivotFieldCollection getColumnFields() {
      return this.b.e;
   }

   public PivotFieldCollection getRowFields() {
      return this.b.d;
   }

   public PivotFieldCollection getPageFields() {
      return this.b.f;
   }

   public PivotFieldCollection getDataFields() {
      return this.b.c;
   }

   public PivotField getDataField() {
      return this.f;
   }

   public PivotFieldCollection getBaseFields() {
      return this.b.b;
   }

   public PivotFilterCollection getPivotFilters() {
      return this.ai;
   }

   int f() {
      return this.g == null ? 0 : this.g.size();
   }

   int g() {
      return this.h == null ? 0 : this.h.size();
   }

   public CellArea getColumnRange() {
      if (!this.s) {
         this.e();
      }

      CellArea var1 = new CellArea();
      var1.StartRow = this.i;
      var1.EndRow = this.n - 1;
      var1.StartColumn = this.o;
      if (this.getColumnFields().getCount() == 0) {
         var1.EndColumn = this.o;
      } else {
         var1.EndColumn = this.l;
      }

      return var1;
   }

   public CellArea getRowRange() {
      if (!this.s) {
         this.e();
      }

      CellArea var1 = new CellArea();
      var1.StartRow = this.n;
      if (this.getRowFields().getCount() == 0) {
         var1.EndRow = this.n;
      } else {
         var1.EndRow = this.j;
      }

      var1.StartColumn = this.k;
      if (this.getRowFields().getCount() == 0) {
         var1.EndColumn = this.o;
      } else {
         var1.EndColumn = this.o - 1;
      }

      return var1;
   }

   public CellArea getDataBodyRange() {
      CellArea var1 = this.getColumnRange();
      CellArea var2 = this.getRowRange();
      CellArea var3 = new CellArea();
      var3.StartRow = var1.EndRow + 1;
      var3.StartColumn = var1.StartColumn;
      var3.EndRow = var2.EndRow;
      var3.EndColumn = var1.EndColumn;
      return var3;
   }

   public CellArea getTableRange1() {
      CellArea var1 = new CellArea();
      if (this.b()) {
         byte[] var2 = (byte[])((byte[])this.Y.get(0));
         var1.StartRow = com.aspose.cells.b.a.zc.e(var2, 4) & '\uffff';
         var1.EndRow = com.aspose.cells.b.a.zc.e(var2, 6) & '\uffff';
         var1.StartColumn = com.aspose.cells.b.a.zc.e(var2, 8) & '\uffff';
         var1.EndColumn = com.aspose.cells.b.a.zc.e(var2, 12) & '\uffff';
         return var1;
      } else {
         if (this.getRefreshDataFlag() && this.d.n != null) {
            if (this.al == null) {
               this.al = new zaut(this);
            }

            this.al.b();
         }

         var1.StartRow = this.i;
         var1.StartColumn = this.k;
         var1.EndRow = this.j;
         var1.EndColumn = this.l;
         return var1;
      }
   }

   public CellArea getTableRange2() {
      int var1 = this.b.f.getCount() == 0 ? 2 : this.b.f.getCount() + 1;
      int var2 = this.i - var1;
      var2 = var2 > 0 ? var2 : 0;
      CellArea var3 = this.getTableRange1();
      var3.StartRow = var2;
      return var3;
   }

   public void move(int row, int column) {
      zakq.a(row);
      zakq.b(column);
      int var3 = row - this.i;
      short var4 = (short)(column - this.k);
      this.i = row;
      this.k = (short)column;
      this.n += var3;
      this.m += var3;
      this.o += var4;
      this.l += var4;
      this.j += var3;
   }

   public void move(String destCellName) {
      byte var2 = 0;
      byte var3 = 0;
      int[] var4 = new int[]{var2};
      int[] var5 = new int[]{var3};
      CellsHelper.a(destCellName, var4, var5);
      int var6 = var4[0];
      int var7 = var5[0];
      this.move(var6, var7);
   }

   /** @deprecated */
   public boolean isColumnGrand() {
      return this.getColumnGrand();
   }

   public boolean getColumnGrand() {
      return this.b.b(1);
   }

   public void setColumnGrand(boolean value) {
      this.b.a(value, 1);
   }

   /** @deprecated */
   public boolean getIsGridDropZones() {
      return this.isGridDropZones();
   }

   /** @deprecated */
   public void setIsGridDropZones(boolean value) {
      this.setGridDropZones(value);
   }

   public boolean isGridDropZones() {
      return this.t;
   }

   public void setGridDropZones(boolean value) {
      this.al = null;
      this.t = value;
      if (value) {
         this.u = false;
         this.v = false;
      }

   }

   /** @deprecated */
   public boolean isRowGrand() {
      return this.getRowGrand();
   }

   public boolean getRowGrand() {
      return this.b.b(2);
   }

   public void setRowGrand(boolean value) {
      this.b.a(value, 2);
   }

   /** @deprecated */
   public boolean displayNullString() {
      return this.getDisplayNullString();
   }

   public boolean getDisplayNullString() {
      return this.c.a(64);
   }

   public void setDisplayNullString(boolean value) {
      this.c.a(value, 64);
   }

   public String getNullString() {
      return this.c.c == null ? "" : this.c.c;
   }

   public void setNullString(String value) {
      this.c.c = value;
   }

   /** @deprecated */
   public boolean displayErrorString() {
      return this.getDisplayErrorString();
   }

   public boolean getDisplayErrorString() {
      return this.c.a(32);
   }

   public void setDisplayErrorString(boolean value) {
      this.c.a(value, 32);
   }

   public String getErrorString() {
      return this.c.b == null ? "" : this.c.b;
   }

   public void setErrorString(String value) {
      this.c.b = value;
   }

   public boolean isAutoFormat() {
      return this.b.b(8);
   }

   public void setAutoFormat(boolean value) {
      this.b.a(value, 8);
      if (!value) {
         this.setAutoFormatType(1);
      }

   }

   public int getAutoFormatType() {
      return this.e.a();
   }

   public void setAutoFormatType(int value) {
      this.al = null;
      this.s = false;
      this.e.c(value);

      label47:
      for(int var2 = 0; var2 < this.getBaseFields().getCount(); ++var2) {
         zbrs var3 = this.getBaseFields().get(var2).c;
         int var4;
         switch(value) {
         case 2:
         case 4:
         case 10:
            var3.b = -96;
            if (this.getRowFields().getCount() > 1) {
               this.getRowFields().get(0).setInsertBlankRow(true);
            }
            break;
         case 3:
         case 9:
            var3.b = 32;
            if (this.getRowFields().getCount() > 1) {
               this.getRowFields().get(0).setInsertBlankRow(true);
            }
            break;
         case 5:
         case 6:
         case 8:
            var3.b = 32;
            if (this.getRowFields().getCount() <= 1) {
               break;
            }

            var4 = 0;

            while(true) {
               if (var4 >= this.getRowFields().getCount() - 1) {
                  continue label47;
               }

               this.getRowFields().get(var4).setInsertBlankRow(true);
               ++var4;
            }
         case 7:
         case 11:
            var3.b = -96;
            if (this.getRowFields().getCount() <= 1) {
               break;
            }

            var4 = 0;

            while(true) {
               if (var4 >= this.getRowFields().getCount() - 1) {
                  continue label47;
               }

               this.getRowFields().get(var4).setInsertBlankRow(true);
               ++var4;
            }
         case 12:
         case 13:
         case 14:
         case 15:
         case 16:
         case 18:
            var3.b = 0;
            if (this.getRowFields().getCount() > 1) {
               this.getRowFields().get(0).setInsertBlankRow(true);
            }
         case 17:
         }
      }

   }

   /** @deprecated */
   public boolean getHasBlankRows() {
      return this.hasBlankRows();
   }

   public boolean hasBlankRows() {
      return this.ap;
   }

   public void setHasBlankRows(boolean value) {
      this.ap = value;

      for(int var2 = 0; var2 < this.getRowFields().getCount(); ++var2) {
         this.getRowFields().get(var2).setInsertBlankRow(value);
      }

   }

   /** @deprecated */
   public boolean mergeLabels() {
      return this.getMergeLabels();
   }

   public boolean getMergeLabels() {
      return this.c.a(16);
   }

   public void setMergeLabels(boolean value) {
      this.c.a(value, 16);
   }

   /** @deprecated */
   public boolean preserveFormatting() {
      return this.getPreserveFormatting();
   }

   public boolean getPreserveFormatting() {
      return this.c.a(8);
   }

   public void setPreserveFormatting(boolean value) {
      this.c.a(value, 8);
   }

   public boolean getShowDrill() {
      return this.I;
   }

   public void setShowDrill(boolean value) {
      this.I = value;
   }

   /** @deprecated */
   public boolean enableDrilldown() {
      return this.getEnableDrilldown();
   }

   public boolean getEnableDrilldown() {
      return this.c.a(2);
   }

   public void setEnableDrilldown(boolean value) {
      this.c.a(value, 2);
   }

   /** @deprecated */
   public boolean enableFieldDialog() {
      return this.getEnableFieldDialog();
   }

   public boolean getEnableFieldDialog() {
      return this.c.a(4);
   }

   public void setEnableFieldDialog(boolean value) {
      this.c.a(value, 4);
   }

   /** @deprecated */
   public boolean enableFieldList() {
      return this.getEnableFieldList();
   }

   public boolean getEnableFieldList() {
      return this.aq;
   }

   public void setEnableFieldList(boolean value) {
      this.aq = value;
   }

   /** @deprecated */
   public boolean enableWizard() {
      return this.getEnableWizard();
   }

   public boolean getEnableWizard() {
      return this.c.a(1);
   }

   public void setEnableWizard(boolean value) {
      this.c.a(value, 1);
   }

   /** @deprecated */
   public boolean subtotalHiddenPageItems() {
      return this.getSubtotalHiddenPageItems();
   }

   public boolean getSubtotalHiddenPageItems() {
      return this.c.a(128);
   }

   public void setSubtotalHiddenPageItems(boolean value) {
      this.c.a(value, 128);
   }

   public String getGrandTotalName() {
      return this.e.b == null ? "Grand Total" : this.e.b;
   }

   public void setGrandTotalName(String value) {
      this.e.b = value;
   }

   /** @deprecated */
   public boolean manualUpdate() {
      return this.getManualUpdate();
   }

   public boolean getManualUpdate() {
      return this.c.b(64);
   }

   public void setManualUpdate(boolean value) {
      this.c.b(value, 64);
   }

   public boolean isMultipleFieldFilters() {
      return this.F;
   }

   public void setMultipleFieldFilters(boolean value) {
      this.F = value;
   }

   public int getMissingItemsLimit() {
      if (this.d != null) {
         if (this.d.B > 32500) {
            return 1;
         } else {
            return this.d.B == 0 ? 2 : 0;
         }
      } else {
         return 0;
      }
   }

   public void setMissingItemsLimit(int value) {
      if (this.d != null) {
         switch(value) {
         case 1:
            this.d.B = 1048576;
            break;
         case 2:
            this.d.B = 0;
            break;
         default:
            this.d.B = -1;
         }
      }

   }

   public boolean getEnableDataValueEditing() {
      return this.O;
   }

   public void setEnableDataValueEditing(boolean value) {
      this.O = value;
   }

   public boolean getShowDataTips() {
      return this.G;
   }

   public void setShowDataTips(boolean value) {
      this.G = value;
   }

   public boolean getShowMemberPropertyTips() {
      return this.H;
   }

   public void setShowMemberPropertyTips(boolean value) {
      this.H = value;
   }

   public boolean getShowValuesRow() {
      return !this.J;
   }

   public void setShowValuesRow(boolean value) {
      this.J = !value;
   }

   public boolean getShowEmptyCol() {
      return this.K;
   }

   public void setShowEmptyCol(boolean value) {
      this.K = value;
   }

   public boolean getShowEmptyRow() {
      return this.L;
   }

   public void setShowEmptyRow(boolean value) {
      this.L = value;
   }

   public boolean getFieldListSortAscending() {
      return this.M;
   }

   public void setFieldListSortAscending(boolean value) {
      this.M = value;
   }

   public boolean getPrintDrill() {
      return this.N;
   }

   public void setPrintDrill(boolean value) {
      this.N = value;
   }

   public String getAltTextTitle() {
      return this.P;
   }

   public void setAltTextTitle(String value) {
      this.P = value;
   }

   public String getAltTextDescription() {
      return this.Q;
   }

   public void setAltTextDescription(String value) {
      this.Q = value;
   }

   public String getName() {
      return this.b.g;
   }

   public void setName(String value) {
      this.b.g = value;
   }

   public String getColumnHeaderCaption() {
      return this.ar;
   }

   public void setColumnHeaderCaption(String value) {
      this.ar = value;
   }

   public int getIndent() {
      return this.C == 127 ? 0 : this.C + 1;
   }

   public void setIndent(int value) {
      if (value == 0) {
         this.C = 127;
      } else {
         this.C = value - 1;
      }

   }

   public String getRowHeaderCaption() {
      return this.as;
   }

   public void setRowHeaderCaption(String value) {
      this.as = value;
   }

   public boolean getShowRowHeaderCaption() {
      return this.D;
   }

   public void setShowRowHeaderCaption(boolean value) {
      this.D = value;
   }

   public boolean getCustomListSort() {
      return this.E;
   }

   public void setCustomListSort(boolean value) {
      this.E = value;
   }

   public PivotFormatConditionCollection getPivotFormatConditions() {
      if (this.aj == null) {
         this.aj = new PivotFormatConditionCollection(this, this.a.b);
      }

      return this.aj;
   }

   public int getPageFieldOrder() {
      switch((byte)(this.c.f & '\uffff' & 1)) {
      case 0:
         return 0;
      case 1:
         return 1;
      default:
         return 0;
      }
   }

   public void setPageFieldOrder(int value) {
      switch(value) {
      case 0:
         this.c.f &= 65534;
         break;
      case 1:
         this.c.f |= 1;
      }

   }

   public int getPageFieldWrapCount() {
      return (this.c.f & '\uffff' & 126) >> 1;
   }

   public void setPageFieldWrapCount(int value) {
      byte var2 = 126;
      this.c.f &= ~(var2 & '\uffff');
      this.c.f |= value << 1;
   }

   public String getTag() {
      return this.c.d;
   }

   public void setTag(String value) {
      this.c.d = value;
   }

   /** @deprecated */
   public boolean saveData() {
      return this.getSaveData();
   }

   public boolean getSaveData() {
      return this.d.d(1);
   }

   public void setSaveData(boolean value) {
      this.d.a(value, 1);
   }

   public boolean getRefreshDataOnOpeningFile() {
      return this.d != null ? this.d.b() : false;
   }

   public void setRefreshDataOnOpeningFile(boolean value) {
      if (this.d != null) {
         this.d.a(value);
      }

   }

   public boolean getRefreshDataFlag() {
      return this.r;
   }

   public void setRefreshDataFlag(boolean value) {
      this.r = value;
   }

   public String[] getDataSource() {
      return this.getSource();
   }

   public void setDataSource(String[] value) throws Exception {
      this.changeDataSource(value);
   }

   private void a(zqr var1, String var2) {
      this.al = null;
      if (var1 != null) {
         if (var2.indexOf("=") != -1 && var2.indexOf("!") == -1) {
            if (var1.b != null) {
               var1.b = this.a.b.getWorkbook().getWorksheets().getNames().get(var2.substring(1)).getRange();
            }

            var1.d = var2.substring(1);
            var1.c = var1.b;
            var1.a = var1.b.getWorksheet();
         } else {
            String var3 = "";
            int var4 = var2.indexOf("!");
            int var5 = var2.indexOf("=");
            if (var4 != -1) {
               if (var5 != -1) {
                  var3 = var2.substring(1, 1 + (var4 - 1));
               } else {
                  var3 = var2.substring(0, 0 + var4);
               }
            }

            Worksheet var6 = this.a.b.getWorkbook().getWorksheets().get(var3);
            if (var6 != null) {
               Name var7 = this.a.b.getWorkbook().getWorksheets().getNames().a(var2.substring(1 + var2.indexOf(33)), var6.getIndex());
               if (var7 != null) {
                  var1.b = var7.getRange();
                  int var8 = var1.b.getName().indexOf(33);
                  if (var8 != -1) {
                     var1.b.a(var1.b.getName().substring(var8 + 1));
                  }

                  var1.d = var2;
                  var1.c = var1.b;
                  var1.a = var1.b.getWorksheet();
               } else {
                  Range var9 = var6.getCells().createRange(var2);
                  var1.b = var9;
                  var1.c = var9;
                  var1.a = var9.getWorksheet();
               }
            }
         }
      }

   }

   public void changeDataSource(String[] source) throws Exception {
      this.al = null;
      boolean var2 = false;

      for(int var3 = 0; var3 < source.length; ++var3) {
         String var4 = source[var3];
         if (var4 != null) {
            WorksheetCollection var5 = this.a.b.getWorkbook().getWorksheets();

            for(int var6 = 0; var6 < var5.getCount(); ++var6) {
               Worksheet var7 = var5.get(var6);

               for(int var8 = 0; var8 < var7.getPivotTables().getCount(); ++var8) {
                  PivotTable var9 = var7.getPivotTables().get(var8);
                  if (var9 != this && var9.d == this.d) {
                     var2 = true;
                     break;
                  }
               }
            }

            if (!var2) {
               if (this.d.e != null) {
                  if (var3 < this.d.e.length) {
                     zqr var10 = this.d.e[var3];
                     this.a(var10, var4);
                  }
               } else if (var4.indexOf("=") != -1 && var4.indexOf("!") == -1) {
                  this.d.D = var4.substring(1);
               }
            } else {
               ++this.d.c.c;
               zauk var11 = new zauk(this.d.c, this.d.c.c, this.d.t);
               var11.a(this.d);
               --this.d.o;
               this.d = var11;
               ++this.d.o;
               this.d.c.a(var11);
               if (this.d.e != null) {
                  if (var3 < this.d.e.length) {
                     zqr var12 = this.d.e[var3];
                     this.a(var12, var4);
                  }
               } else if (var4.indexOf("=") != -1 && var4.indexOf("!") == -1) {
                  this.d.D = var4.substring(1);
               }
            }
         }
      }

   }

   public String[] getSource() {
      if (this.d == null) {
         return null;
      } else if (this.d.d != 1 && this.d.d != 4) {
         return null;
      } else {
         return this.d.e != null ? this.d.g() : null;
      }
   }

   public void refreshData() {
      this.al = null;
      if (this.d == null) {
         throw new CellsException(19, "this data source is not supported.");
      } else if (this.d.d != 1) {
         throw new CellsException(19, "this data source is not supported.");
      } else if (this.d.e == null) {
         throw new CellsException(19, "this name or range is not supported.");
      } else {
         for(int var1 = 0; var1 < this.d.e.length; ++var1) {
            Range var2 = this.d.e[var1].c;
            this.d.d(this.d.e[var1].a());
            ArrayList var3 = new ArrayList();
            if (this.d.p != null) {
               this.d.a(var3);
            }

            if (var2 != null && !this.d.e[var1].b.a().e(var2.a()) || this.getBaseFields().getCount() != this.d.i + var3.size() || this.d.H) {
               this.a(this.d.e[var1].b.a());
            }
         }

         this.c();
         this.l();
         this.k();
         this.j();
         this.i();
      }
   }

   private void i() {
      zbmv var1 = this.a.b.c().W();
      int var2 = var1.getCount();
      zbmu var3 = null;

      for(int var4 = 0; var4 < var2; ++var4) {
         var3 = var1.a(var4);
         if (null != this.d && -1 != this.d.a && (var3.h & 4294967295L) == (long)this.d.a) {
            var3.h();
         }
      }

   }

   private void j() {
      PivotFormatCondition var1 = null;
      ArrayList var2 = null;
      zbro var3 = null;
      ArrayList var4 = null;

      for(int var5 = 0; var5 < this.getPivotFormatConditions().getCount(); ++var5) {
         var1 = this.getPivotFormatConditions().get(var5);
         var2 = var1.b;

         for(int var6 = 0; var6 < var2.size(); ++var6) {
            var3 = (zbro)var2.get(var6);
            var4 = var3.e;

            for(int var7 = 0; var7 < var4.size(); ++var7) {
               if (this.a((zbqw)var4.get(var7))) {
                  var4.remove(var7);
                  --var7;
               }
            }

            if (var4.size() == 0) {
               var2.remove(var6);
               --var6;
            }
         }

         if (var2.size() == 0) {
            this.getPivotFormatConditions().removeAt(var5);
            --var5;
         }
      }

   }

   private boolean a(zbqw var1) {
      int var2 = var1.b() & '\uffff';
      int var3 = -1;
      if (var2 == 65534) {
         var3 = this.getDataFields().getCount();
      } else {
         if (var2 >= this.getBaseFields().getCount()) {
            return true;
         }

         if (this.getBaseFields().get(var2).h != null) {
            var3 = this.getBaseFields().get(var2).h.c.size();
         }
      }

      if (var3 != -1 && var3 != 0) {
         ArrayList var4 = var1.c;

         for(int var5 = 0; var5 < var4.size(); ++var5) {
            if ((Integer)var4.get(var5) >= var3) {
               var4.remove(var5);
               --var5;
            }
         }

         return var4.size() == 0;
      } else {
         return true;
      }
   }

   private void k() {
      int var1 = this.ag.getCount();
      ArrayList var2 = new ArrayList();

      zbqy var4;
      for(int var3 = 0; var3 < var1; ++var3) {
         var4 = this.ag.a(var3);
         if ((var4.c.b & 255) != 255 && (var4.c.b & 255) >= this.getBaseFields().getCount()) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)this.ag.a(var3));
         } else if (var4.c.e.size() > 0) {
            for(int var5 = 0; var5 < var4.c.e.size(); ++var5) {
               zbqw var6 = (zbqw)var4.c.e.get(var5);
               if (var6 != null) {
                  int var7 = var6.b();
                  if ((var7 & '\uffff') != 65534 && (var7 & '\uffff') >= this.getBaseFields().getCount() || (var7 & '\uffff') != 65534 && this.getBaseFields().get(var7 & '\uffff').h != null && this.getBaseFields().get(var7 & '\uffff').h.c != null && this.a(var6.c, this.getBaseFields().get(var7 & '\uffff').h.c.size() - 1) || (var7 & '\uffff') == 65534 && this.a(var6.c, this.getDataFields().getCount() - 1)) {
                     com.aspose.cells.b.a.a.ze.a(var2, (Object)this.ag.a(var3));
                     break;
                  }
               }
            }
         }
      }

      Iterator var8 = var2.iterator();

      while(var8.hasNext()) {
         var4 = (zbqy)var8.next();
         this.ag.b(var4);
      }

   }

   private boolean a(ArrayList var1, int var2) {
      for(int var3 = 0; var3 < var1.size(); ++var3) {
         if ((Integer)((Integer)var1.get(var3)) > var2) {
            return true;
         }
      }

      return false;
   }

   private void l() {
      if (this.g != null) {
         this.g.clear();
      }

      if (this.h != null) {
         this.h.clear();
      }

      Iterator var1 = this.getRowFields().a.iterator();

      PivotField var2;
      while(var1.hasNext()) {
         var2 = (PivotField)var1.next();
         if (var2.getBaseIndex() != -2 && var2.getBaseIndex() != 65534) {
            var2.d.b = (ArrayList)this.getBaseFields().get(var2.getBaseIndex()).d.b.clone();
         }
      }

      var1 = this.getColumnFields().a.iterator();

      while(var1.hasNext()) {
         var2 = (PivotField)var1.next();
         if (var2.getBaseIndex() != -2 && var2.getBaseIndex() != 65534) {
            var2.d.b = (ArrayList)this.getBaseFields().get(var2.getBaseIndex()).d.b.clone();
         }
      }

      var1 = this.getPageFields().a.iterator();

      while(var1.hasNext()) {
         var2 = (PivotField)var1.next();
         if (var2.getBaseIndex() != -2 && var2.getBaseIndex() != 65534) {
            var2.d.b = (ArrayList)this.getBaseFields().get(var2.getBaseIndex()).d.b.clone();
         }
      }

      if (this.getDataField() != null) {
         this.getDataField().d.b.clear();

         for(int var4 = 0; var4 < this.getDataFields().a.size(); ++var4) {
            var2 = (PivotField)this.getDataFields().a.get(var4);
            PivotItem var3 = new PivotItem(this.f.d);
            this.f.d.a(var3);
            var3.setIndex(var4);
            var3.e = var2;
         }
      }

   }

   public void calculateData() throws Exception {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.a();
   }

   public void clearData() {
      int var1 = this.getPageFields().getCount();
      Cells var2 = this.a.b.getCells();
      if (var1 > 0) {
         var2.clearRange(this.i - var1 - 1, this.k, this.i - 2, this.l);
      }

      var2.clearRange(this.i, this.k, this.j, this.l);
      this.al = null;
   }

   void a(Chart var1, String var2) {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.a(var1, var2);
   }

   public void calculateRange() {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.b();
   }

   public void formatAll(Style style) {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.a(style);
   }

   public void format(int row, int column, Style style) {
      if (this.al == null) {
         this.al = new zaut(this);
      }

      this.al.a(row, column, style);
   }

   boolean b(int var1, int var2) {
      if (var2 < 0 && var1 <= this.i && var1 - var2 - 1 >= this.j) {
         return true;
      } else {
         if (var1 <= this.i) {
            this.i += var2;
            this.m += var2;
            this.n += var2;
            this.j += var2;
         } else if (var1 <= this.j) {
            throw new IllegalArgumentException("The row index should not be inside the pivottable report");
         }

         return false;
      }
   }

   boolean c(int var1, int var2) {
      if (var2 < 0 && var1 <= this.k && var1 - var2 - 1 >= this.l) {
         return true;
      } else {
         if (var1 <= this.k) {
            this.k += var2;
            this.o += var2;
            this.l += var2;
         } else if (var1 <= this.j) {
            throw new IllegalArgumentException("The column index should not be inside the pivottable report");
         }

         return false;
      }
   }

   boolean a(CellArea var1, int var2, int var3) {
      switch(var3) {
      case 0:
         if (var1.StartColumn <= this.k && var1.EndColumn >= this.l) {
            return this.b(var1.StartRow, var2);
         }
         break;
      case 1:
         if (var1.StartRow <= this.i && var1.EndRow >= this.j) {
            return this.c(var1.StartColumn, -var2);
         }
      case 2:
      default:
         break;
      case 3:
         if (var1.StartRow <= this.i && var1.EndRow >= this.j) {
            return this.c(var1.StartColumn, var2);
         }
         break;
      case 4:
         if (var1.StartColumn <= this.k && var1.EndColumn >= this.l) {
            return this.b(var1.StartRow, -var2);
         }
      }

      return false;
   }

   public boolean getItemPrintTitles() {
      return this.e.a(32);
   }

   public void setItemPrintTitles(boolean value) {
      this.e.a(value, 32);
   }

   /** @deprecated */
   public boolean printTitles() {
      return this.getPrintTitles();
   }

   public boolean getPrintTitles() {
      return this.e.a(2);
   }

   public void setPrintTitles(boolean value) {
      PageSetup var2 = this.a.b.getPageSetup();
      if (value) {
         CellArea var3 = this.getColumnRange();
         CellArea var4 = this.getRowRange();
         String var5 = "$" + (var3.StartRow + 1) + ":$" + (var4.StartRow + 1);
         String var6 = "$" + CellsHelper.columnIndexToName(var4.StartColumn) + ":$" + CellsHelper.columnIndexToName(var4.StartColumn);
         var2.a(var5 + "," + var6);
      } else {
         var2.a((String)null);
      }

      this.e.a(value, 2);
   }

   /** @deprecated */
   public boolean displayImmediateItems() {
      return this.getDisplayImmediateItems();
   }

   public boolean getDisplayImmediateItems() {
      return this.ab.b();
   }

   public void setDisplayImmediateItems(boolean value) {
      this.ab.a(value);
      this.al = null;
   }

   public boolean isSelected() {
      return this.Z.a();
   }

   public void setSelected(boolean value) {
      if (value) {
         Iterator var2 = this.a.iterator();

         while(var2.hasNext()) {
            PivotTable var3 = (PivotTable)var2.next();
            if (var3 == this) {
               var3.Z.a(true);
            } else {
               var3.Z.a(false);
            }
         }
      } else {
         this.Z.a(value);
      }

   }

   public boolean getShowPivotStyleRowHeader() {
      return (this.at & 255 & 1) != 0;
   }

   public void setShowPivotStyleRowHeader(boolean value) {
      if (value) {
         this.at = (byte)(this.at | 1);
      } else {
         this.at = (byte)(this.at & 254);
      }

   }

   public boolean getShowPivotStyleColumnHeader() {
      return (this.at & 255 & 2) != 0;
   }

   public void setShowPivotStyleColumnHeader(boolean value) {
      if (value) {
         this.at = (byte)(this.at | 2);
      } else {
         this.at = (byte)(this.at & 253);
      }

   }

   public boolean getShowPivotStyleRowStripes() {
      return (this.at & 255 & 4) != 0;
   }

   public void setShowPivotStyleRowStripes(boolean value) {
      if (value) {
         this.at = (byte)(this.at | 4);
      } else {
         this.at = (byte)(this.at & 251);
      }

   }

   public boolean getShowPivotStyleColumnStripes() {
      return (this.at & 255 & 8) != 0;
   }

   public void setShowPivotStyleColumnStripes(boolean value) {
      if (value) {
         this.at = (byte)(this.at | 8);
      } else {
         this.at = (byte)(this.at & 247);
      }

   }

   public boolean getShowPivotStyleLastColumn() {
      return (this.at & 255 & 16) != 0;
   }

   public void setShowPivotStyleLastColumn(boolean value) {
      if (value) {
         this.at = (byte)(this.at | 16);
      } else {
         this.at = (byte)(this.at & 239);
      }

   }

   public void setAutoGroupField(int baseFieldIndex) {
      PivotField var2 = this.getBaseFields().get(baseFieldIndex);
      if (var2 != null && (var2.m == 1 || var2.m == 2)) {
         this.setAutoGroupField(var2);
      } else {
         throw new IllegalArgumentException("Invalid pivot field index");
      }
   }

   public void setAutoGroupField(PivotField pivotField) {
      if (pivotField != null && (pivotField.m == 1 || pivotField.m == 2)) {
         zbqs var2 = pivotField.h;
         var2.j = new SxRng(var2);
         var2.b |= 16;
         SxRng var3 = var2.j;
         var3.a = true;
         var3.b = true;
         var3.k = pivotField.t;
         String[] var4;
         int var7;
         Object[] var12;
         if (var2.p()) {
            var4 = var2.x();
            var3.j = 1.0D;
            var3.h = zase.B(var4[0]);
            var3.i = zase.B(var4[1]);
            var3.d = new ArrayList();
            if (var2.u()) {
               zbmb var5 = new zbmb();
               var5.a = null;
               com.aspose.cells.b.a.a.ze.a(var3.d, (Object)var5);
            }

            var12 = var2.a(var3);
            Object[] var6 = var12;
            var7 = var12.length;

            for(int var8 = 0; var8 < var7; ++var8) {
               Object var9 = var6[var8];
               zbmb var10 = new zbmb();
               var10.a = var9;
               com.aspose.cells.b.a.a.ze.a(var3.d, (Object)var10);
            }

            pivotField.e();
            pivotField.d();
         } else if (var2.o()) {
            var4 = var2.x();
            var3.c = 5;

            try {
               var3.f = DateTime.a(var4[0]);
               var3.g = DateTime.a(var4[1]);
            } catch (Exception var11) {
               ;
            }

            var3.j = 1.0D;
            var3.d = new ArrayList();
            var12 = var2.a(var3);
            int var13 = var12.length;

            for(var7 = 0; var7 < var13; ++var7) {
               Object var14 = var12[var7];
               zbmb var15 = new zbmb();
               var15.a = var14;
               com.aspose.cells.b.a.a.ze.a(var3.d, (Object)var15);
            }

            pivotField.e();
            pivotField.d();
         }

      } else {
         throw new IllegalArgumentException("Invalid pivot field.");
      }
   }

   public void setManualGroupField(int baseFieldIndex, double startVal, double endVal, ArrayList groupByList, double intervalNum) {
      PivotField var9 = this.getBaseFields().get(baseFieldIndex);
      if (var9 != null && (var9.m == 1 || var9.m == 2)) {
         this.setManualGroupField(var9, startVal, endVal, groupByList, intervalNum);
      } else {
         throw new IllegalArgumentException("Invalid pivot field index.");
      }
   }

   public void setManualGroupField(PivotField pivotField, double startVal, double endVal, ArrayList groupByList, double intervalNum) {
      if (pivotField != null && (pivotField.m == 1 || pivotField.m == 2)) {
         if (groupByList != null) {
            zbqs var9 = pivotField.h;
            var9.h(true);
            var9.j = new SxRng(var9);
            SxRng var10 = var9.j;
            var10.b = false;
            var10.a = false;
            var10.k = pivotField.t;
            if (endVal < startVal) {
               throw new IllegalArgumentException("The start value must not be greater than the end value.");
            }

            if (groupByList.size() != 1 || (Integer)groupByList.get(0) != 0 || intervalNum <= 0.0D) {
               throw new IllegalArgumentException("Invalid parameters for numeric grouping.");
            }

            var10.h = startVal;
            var10.i = endVal;
            var10.j = intervalNum;
            var10.c = 0;
            var10.d = new ArrayList();
            Object[] var11 = var9.a(com.aspose.cells.b.a.zn.b(startVal), com.aspose.cells.b.a.zn.b(endVal), groupByList, intervalNum, 0);
            Object[] var12 = var11;
            int var13 = var11.length;

            for(int var14 = 0; var14 < var13; ++var14) {
               Object var15 = var12[var14];
               zbmb var16 = new zbmb();
               var16.a = var15;
               com.aspose.cells.b.a.a.ze.a(var10.d, (Object)var16);
            }

            pivotField.e();
            pivotField.d();
         }

      } else {
         throw new IllegalArgumentException("Invalid pivot field.");
      }
   }

   public void setManualGroupField(int baseFieldIndex, DateTime startVal, DateTime endVal, ArrayList groupByList, int intervalNum) {
      PivotField var6 = this.getBaseFields().get(baseFieldIndex);
      if (var6 != null && (var6.m == 1 || var6.m == 2)) {
         this.setManualGroupField(var6, startVal, endVal, groupByList, intervalNum);
      } else {
         throw new IllegalArgumentException("Invalid pivot field index.");
      }
   }

   public void setManualGroupField(PivotField pivotField, DateTime startVal, DateTime endVal, ArrayList groupByList, int intervalNum) {
      if (pivotField != null && (pivotField.m == 1 || pivotField.m == 2)) {
         if (groupByList != null) {
            zbqs var6 = pivotField.h;
            var6.h(true);
            var6.j = new SxRng(var6);
            SxRng var7 = var6.j;
            var7.b = false;
            var7.a = false;
            var7.k = pivotField.t;
            String var8 = startVal.a("yyyy-MM-dd\\THH:mm:ss.fff", com.aspose.cells.b.a.c.za.b());
            String var9 = endVal.a("yyyy-MM-dd\\THH:mm:ss.fff", com.aspose.cells.b.a.c.za.b());
            if (var9.compareTo(var8) < 0) {
               throw new IllegalArgumentException("The start value must not be greater than the end value.");
            }

            try {
               pivotField.h.j.f = DateTime.a(var8);
               pivotField.h.j.g = DateTime.a(var9);
            } catch (Exception var23) {
               ;
            }

            if (groupByList.contains(0)) {
               groupByList.remove(0);
            }

            Collections.sort(groupByList);
            Object[] var11;
            int var13;
            int var25;
            if (groupByList.size() == 1 && (Integer)groupByList.get(0) == 4) {
               if (intervalNum <= 0 || intervalNum >= 32768) {
                  throw new IllegalArgumentException("The number of days must be positive integer of nonzero, between 1 and 32767.");
               }

               pivotField.h.j.j = (double)intervalNum;
               var7.c = 4;
               var7.d = new ArrayList();
               pivotField.d = new PivotItemCollection(pivotField);
               Object[] var24 = var6.a(var8, var9, groupByList, (double)intervalNum, 4);
               var11 = var24;
               var25 = var24.length;

               for(var13 = 0; var13 < var25; ++var13) {
                  Object var28 = var11[var13];
                  zbmb var30 = new zbmb();
                  var30.a = var28;
                  com.aspose.cells.b.a.a.ze.a(var7.d, (Object)var30);
               }

               pivotField.e();
               pivotField.d();
            } else {
               int var10 = (Integer)groupByList.get(0);
               var7.c = var10;
               var7.d = new ArrayList();
               pivotField.d = new PivotItemCollection(pivotField);
               var11 = var6.a(var8, var9, groupByList, 0.0D, var10);
               Object[] var12 = var11;
               var13 = var11.length;

               for(int var14 = 0; var14 < var13; ++var14) {
                  Object var15 = var12[var14];
                  zbmb var16 = new zbmb();
                  var16.a = var15;
                  com.aspose.cells.b.a.a.ze.a(var7.d, (Object)var16);
               }

               pivotField.e();
               pivotField.d();

               for(var25 = 1; var25 < groupByList.size(); ++var25) {
                  PivotField var26 = new PivotField(this.getBaseFields());
                  this.getBaseFields().a(var26);
                  var26.t = this.getBaseFields().getCount() - 1;
                  var26.setShowInOutlineForm(true);
                  var26.setShowCompact(true);
                  var26.setShowSubtotalAtTop(true);
                  if (pivotField.m == 1) {
                     this.getRowFields().a(var26, 0);
                  } else {
                     this.getColumnFields().a(var26, 0);
                  }

                  var26.setAutoSubtotals(false);
                  var26.m = pivotField.m;
                  zbqs var27 = new zbqs(this.d);
                  var27.h(true);
                  var26.h = var27;
                  var10 = (Integer)groupByList.get(var25);
                  SxRng var29 = new SxRng(var27);
                  var27.j = var29;
                  var29.c = var10;
                  var29.k = pivotField.t;

                  try {
                     var29.f = DateTime.a(var8);
                     var29.g = DateTime.a(var9);
                  } catch (Exception var22) {
                     ;
                  }

                  var29.j = 1.0D;
                  String var31 = zavb.d(var10);
                  var27.a = var31.replace(var31.charAt(0), (char)(var31.charAt(0) - 32));
                  var27.o = true;
                  var29.d = new ArrayList();
                  var11 = var27.a(var8, var9, groupByList, 0.0D, var10);
                  Object[] var17 = var11;
                  int var18 = var11.length;

                  for(int var19 = 0; var19 < var18; ++var19) {
                     Object var20 = var17[var19];
                     zbmb var21 = new zbmb();
                     var21.a = var20;
                     com.aspose.cells.b.a.a.ze.a(var29.d, (Object)var21);
                  }

                  var27.c = null;
                  var26.d();
                  com.aspose.cells.b.a.a.ze.a(this.d.p, (Object)var27);
               }
            }
         }

      } else {
         throw new IllegalArgumentException("Invalid pivot field.");
      }
   }

   public void setUngroup(int baseFieldIndex) {
      PivotField var2 = this.getBaseFields().get(baseFieldIndex);
      if (var2 != null && (var2.m == 1 || var2.m == 2)) {
         this.setUngroup(var2);
      } else {
         throw new IllegalArgumentException("Invalid pivot field index.");
      }
   }

   public void setUngroup(PivotField pivotField) {
      if (pivotField != null && (pivotField.m == 1 || pivotField.m == 2)) {
         pivotField.h.j = null;
         pivotField.h.h(false);
         pivotField.e();
         pivotField.initPivotItems();
      } else {
         throw new IllegalArgumentException("Invalid pivot field.");
      }
   }

   private void a(ArrayList var1, zqa var2) throws Exception {
      Iterator var3 = var1.iterator();

      while(var3.hasNext()) {
         byte[] var4 = (byte[])var3.next();
         var2.a(var4);
      }

   }

   void a(zqa var1) throws Exception {
      if (this.Y != null) {
         this.a(this.Y, var1);
      } else {
         zbrz var2 = new zbrz(this.b);
         var2.a(var1);
         this.b(var1);
         this.c(var1);
         zbre var3 = new zbre();
         var3.a(this.g);
         var3.a(var1);
         var3.a(this.h);
         var3.a(var1);
         this.c.a = (short)this.ag.getCount();
         zbqr var4 = new zbqr(this.c);
         var4.a(var1);
         if (this.c.l != null) {
            this.a(this.c.l, var1);
         }

         for(int var5 = 0; var5 < this.ag.getCount(); ++var5) {
            zbqy var6 = this.ag.a(var5);
            if (var6.a != 1 || var6.b != -1) {
               zbra var7 = new zbra(var6);
               Style var8 = var6.a();
               zbqo var9 = new zbqo(var8);
               var7.b(var9.d());
               var7.a(var1);
               zbro var10 = var6.c;
               zbrp var11 = new zbrp(var10);
               var11.a(var1);

               for(int var12 = 0; var12 < var10.e.size(); ++var12) {
                  zbqw var13 = (zbqw)var10.e.get(var12);
                  zbqx var14 = new zbqx(var13);
                  var14.a(var1);
                  if (var13.c.size() > 0) {
                     zbrc var15 = new zbrc(var13.c);
                     var15.a(var1);
                  }
               }

               var9.a(var1);
            }
         }

         try {
            zayi var17 = new zayi();
            var17.a(this.Z);
            var17.a(var1);
         } catch (Exception var16) {
            ;
         }

         zbry var18 = new zbry(this.e);
         var18.a(var1);
         if (this.ab.getCount() > 0) {
            PivotField var19 = null;

            for(int var20 = 0; var20 < this.ab.getCount(); ++var20) {
               byte[] var21 = this.ab.a(var20);
               if (var21[0] == 0) {
                  if (var21[1] == 30) {
                     zays.a(var1, 0, 30, this, (zauk)null, (PivotField)null);
                  } else if (var21[1] == 2) {
                     zays.a(var1, 0, 2, this, (zauk)null, (PivotField)null);
                  } else {
                     zays.a(var1, (byte[])this.ab.a(var20));
                  }
               } else if (var21[0] == 23) {
                  if (var21[1] == 0) {
                     byte var22 = 8;
                     short var24 = com.aspose.cells.b.a.zc.b(var21, var22);
                     if (var24 > 0) {
                        int var23 = var22 + 2;
                        int[] var25 = new int[]{var23};
                        String var26 = zavb.a(var25, var24, var21);
                        var23 = var25[0];
                        var19 = this.getBaseFields().get(var26);
                     }

                     zays.a(var1, (byte[])this.ab.a(var20));
                  } else if (var21[1] == 25) {
                     zays.a(var1, 23, 25, this, (zauk)null, var19);
                  } else {
                     zays.a(var1, (byte[])this.ab.a(var20));
                  }
               } else {
                  zays.a(var1, (byte[])this.ab.a(var20));
               }
            }
         } else {
            zays.a(var1, this);
         }

      }
   }

   void b(zqa var1) throws Exception {
      Iterator var2 = this.getBaseFields().a.iterator();

      while(var2.hasNext()) {
         PivotField var3 = (PivotField)var2.next();
         zbru var4 = new zbru();
         var4.a(var3.b);
         var4.a(var1);
         if (var3.d != null && var3.d.getCount() != 0) {
            var3.d.a(var1);
         }

         zbrt var5 = new zbrt();
         var5.a(var3.c);
         var5.a(var1);
      }

   }

   void c(zqa var1) throws Exception {
      PivotFieldCollection var2 = this.b.d;
      PivotFieldCollection var3 = this.b.e;
      PivotFieldCollection var4 = this.b.f;
      PivotFieldCollection var5 = this.b.c;
      int var6 = var2.getCount();
      int var7 = var3.getCount();
      zbsa var8 = new zbsa();
      if (var6 != 0) {
         var8.a(var2);
         var8.a(var1);
      }

      if (var7 != 0) {
         var8.a(var3);
         var8.a(var1);
      }

      if (var4.getCount() != 0) {
         zbrm var9 = new zbrm();
         var9.a(var4);
         var9.a(var1);
      }

      if (var5.getCount() != 0) {
         zbqp var11 = new zbqp();

         for(int var10 = 0; var10 < var5.getCount(); ++var10) {
            var11.a(var5.get(var10).i);
            var11.a(var1);
         }
      }

   }

   public ArrayList getHorizontalBreaks() {
      ArrayList var1 = new ArrayList();
      if (null != this && null != this.g) {
         int var2 = this.i;
         if (this.getColumnFields() != null && this.getColumnFields().getCount() > 0) {
            var2 += 1 + this.getColumnFields().getCount();
         } else {
            ++var2;
         }

         int var3 = this.getRowFields().getCount();
         if (var3 < 1) {
            return var1;
         }

         int[] var4 = new int[var3 - 1];
         PivotField var5 = null;

         for(int var6 = 0; var6 < var3 - 1; ++var6) {
            var5 = this.getRowFields().get(var6);
            if (var5.c() < 0) {
               var4[var6] = 0;
            } else {
               var4[var6] = var5.isInsertPageBreaksBetweenItems() ? 1 : 0;
            }
         }

         int[] var10 = new int[4 + var3];
         int[] var7 = new int[4 + var3];

         for(int var8 = 0; var8 < this.g.size() - 1; ++var8) {
            ++var2;
            var10 = (int[])((int[])this.g.get(var8));
            var7 = (int[])((int[])this.g.get(var8 + 1));
            if (var8 + 1 == this.g.size() - 1) {
               break;
            }

            for(int var9 = 0; var9 < var4.length; ++var9) {
               if (var10[4 + var9] != var7[4 + var9] && 1 == var4[var9]) {
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var2);
               }
            }
         }
      }

      return var1;
   }

   public void showInCompactForm() {
      this.u = true;
      this.v = true;
      this.w = true;
      this.x = true;
      int var1 = this.getBaseFields().getCount();
      PivotField var2 = null;

      for(int var3 = 0; var3 < var1; ++var3) {
         var2 = this.getBaseFields().get(var3);
         var2.setShowCompact(true);
         var2.setShowInOutlineForm(true);
      }

   }

   public void showInOutlineForm() {
      this.u = false;
      this.v = false;
      this.w = true;
      this.x = true;
      int var1 = this.getBaseFields().getCount();
      PivotField var2 = null;

      for(int var3 = 0; var3 < var1; ++var3) {
         var2 = this.getBaseFields().get(var3);
         var2.setShowCompact(false);
         var2.setShowInOutlineForm(true);
      }

   }

   public void showInTabularForm() {
      this.u = false;
      this.v = false;
      this.w = false;
      this.x = false;
      int var1 = this.getBaseFields().getCount();
      PivotField var2 = null;

      for(int var3 = 0; var3 < var1; ++var3) {
         var2 = this.getBaseFields().get(var3);
         var2.setShowCompact(false);
         var2.setShowInOutlineForm(false);
      }

   }

   public Cell getCellByDisplayName(String displayName) {
      Cells var2 = this.a.b.getCells();

      int var3;
      int var4;
      for(var3 = this.i; var3 < this.n; ++var3) {
         for(var4 = this.k; var4 <= this.l; ++var4) {
            if (displayName != null && displayName.equals(var2.get(var3, var4).getStringValue())) {
               return var2.get(var3, var4);
            }
         }
      }

      for(var3 = this.n; var3 <= this.j; ++var3) {
         for(var4 = this.k; var4 < this.o; ++var4) {
            if (displayName != null && displayName.equals(var2.get(var3, var4).getStringValue())) {
               return var2.get(var3, var4);
            }
         }
      }

      return null;
   }
}
